/**
 * 部门管理
 */
Ext.namespace('system.Office');
system.Office.fields=[];
system.Office.className="com.wef.system.entity.Office";	
var length=0;

length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="officeId";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=50;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=false; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="officeCode";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=50;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=false; 
system.Office.fields[length].validators={maxLength : 50};
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=true; 
system.Office.fields[length].displayInList=true; 
system.Office.fields[length].displayInQuery=true; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="officeName";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=100;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].validators={maxLength : 200};
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=true; 
system.Office.fields[length].displayInList=true; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="address";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=200;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].validators={maxLength : 200};
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=true; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="homeCurrency";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=3;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].validators={maxLength : 3};
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=true; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="xchgrName";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=20;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].validators={maxLength : 20};
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=true; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 

length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="officeType";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=1;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=true; 
system.Office.fields[length].displayInList=true; 
system.Office.fields[length].displayInQuery=false; 
system.Office.fields[length].display={}; 
var statenames = [
        ['1', 'AGENT'],
        ['2', 'COMPANY'],
        ['3', 'DEPARTMENT'],
        ['4', 'OFFICE']
        ];
var itemObject = {
	xtype : 'combo',
    fieldLabel : system.Office.officeType,
    store : new Ext.data.SimpleStore({
         fields:['oid', 'officeType'],
         data:statenames
    }),
    name : 'officeType',
    displayField : 'officeType',
    valueField : 'oid',
    typeAhead : true,
    minChars : 0,
//	pageSize : 15,
    mode : 'local',
    triggerAction : 'all',
    emptyText : '请选择...',
    selectOnFocus : true,
    forceSelection : true
};
system.Office.fields[length].display.itemObject=itemObject;
system.Office.fields[length].display.displayType="combo";

length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="companyId";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=50;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="custId";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=50;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="blContent";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=400;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="functionType";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=10;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="language";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=20;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].validators={maxLength : 20};
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=true; 
system.Office.fields[length].displayInList=true; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="autoInternal";
system.Office.fields[length].dataType="Boolean";
system.Office.fields[length].length=1;  
system.Office.fields[length].scale=0; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="superiorOfficeId";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=20;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="tel";
system.Office.fields[length].vtype="phone";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=20;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].validators={maxLength : 50};
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=true; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="fax";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=20;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].validators={maxLength : 50};
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=true; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="inputUser";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=10;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="inputOffice";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=20;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="useSystem";
system.Office.fields[length].dataType="Boolean";
system.Office.fields[length].length=1;  
system.Office.fields[length].scale=0; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="countryId";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=50;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="settleOffice";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=20;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=true; 
system.Office.fields[length].validators={maxLength : 20};
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="taxRegisterNo";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=50;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].validators={maxLength : 50};
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=true; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="businessRegisterNo";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=50;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].validators={maxLength : 50};
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=true; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="officeNativeName";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=200;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].validators={maxLength : 200};
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=true; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="abbrev";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=20;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].validators={maxLength : 50};
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=true; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="email";
system.Office.fields[length].vtype="email";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=200;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].validators={maxLength : 200};
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=true; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 



length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="superiorOfficeCode";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=5;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=true; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 
system.Office.fields[length].display={};
system.Office.fields[length].display.displayType="combo";
var officeDs = new Ext.data.Store({
	proxy : new Gfa.data.DwrProxy(CommonService),
	reader : new Gfa.data.DwrReader({}, ['officeCode', 'officeName']),
	pruneModifiedRecords : true,
	remoteSort : false
});
var cmOffice = new Ext.grid.ColumnModel([{
	header : system.Office.officeName,
	dataIndex : 'officeName',
	width : 250
}]);
var itemObject ={
	xtype : 'gfaCombobox',
	name : 'superiorOfficeCode',
	fieldLabel : system.Office.superiorOfficeCode,
	store : officeDs,
	cm : cmOffice,
	displayField : 'officeName',
	valueField : 'officeCode',
	listType : 'grid',
	listWidth : 250,
	maxHeight : 400,
	pageSize : 15,
	//matchType : 'likeanywhere',
	queryObjectName : 'com.wef.system.entity.Office',
	orderByProps : {
		'officeName' : 'asc'
	},
	triggerAction : 'all',
	emptyText : '请选择...',
	selectOnFocus : true,
	forceSelection : true,
	anchor : '-10'
};
system.Office.fields[length].display.itemObject=itemObject;

length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="cityId";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=50;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="isDept";
system.Office.fields[length].dataType="Boolean";
system.Office.fields[length].length=1;  
system.Office.fields[length].scale=0; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 
system.Office.fields[length].display={};
system.Office.fields[length].display.displayType="checkbox";

length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="officeRelactionTag";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=200;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="isCustomer";
system.Office.fields[length].dataType="Boolean";
system.Office.fields[length].length=1;  
system.Office.fields[length].scale=0; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=true; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 
system.Office.fields[length].display={};
system.Office.fields[length].display.displayType="checkbox";

length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="inputUserName";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=40;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="isInternal";
system.Office.fields[length].dataType="Boolean";
system.Office.fields[length].length=1;  
system.Office.fields[length].scale=0; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="createdByUser";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=10;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="createdOffice";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=5;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="createdDtmLoc";
system.Office.fields[length].dataType="java.util.Date";
system.Office.fields[length].length=-1;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="createdTimeZone";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=10;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="updatedByUser";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=10;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="updatedOffice";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=5;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="updatedDtmLoc";
system.Office.fields[length].dataType="java.util.Date";
system.Office.fields[length].length=-1;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="updatedTimeZone";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=10;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="recordVersion";
system.Office.fields[length].dataType="Long";
system.Office.fields[length].length=10;  
system.Office.fields[length].scale=0; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=false; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="regionId";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=50;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="regionCode";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=3;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="portId";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=50;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="portCode";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=10;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="countryCode";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=2;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="cityCode";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=5;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="contact";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=100;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="custCode";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=20;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="companyCode";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=10;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="principalGroupCode";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=50;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 


length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="departmentId";
system.Office.fields[length].dataType="String";
system.Office.fields[length].length=50;  
system.Office.fields[length].scale=-1; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=false; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 

length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="active";
system.Office.fields[length].dataType="Boolean";
system.Office.fields[length].length=1;  
system.Office.fields[length].scale=0; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=true; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 
system.Office.fields[length].display={};
system.Office.fields[length].display.displayType="checkbox";

length=system.Office.fields.length;
system.Office.fields[length]={};
system.Office.fields[length].fieldName="deleted";
system.Office.fields[length].dataType="Boolean";
system.Office.fields[length].length=1;  
system.Office.fields[length].scale=0; 
system.Office.fields[length].allowEdit=false; 
system.Office.fields[length].allowNull=true; 
system.Office.fields[length].defaultValue=""; 
system.Office.fields[length].displayInForm=true; 
system.Office.fields[length].displayInList=false; 
system.Office.fields[length].displayInQuery=false; 
system.Office.fields[length].display={};
system.Office.fields[length].display.displayType="checkbox";



OfficeManager = function(){
	OfficeManager.superclass.constructor.call(this);
	var viewIndex = this.cm.findColumnIndex('officeType');
	this.cm.setRenderer(viewIndex, function(value){
		if(value=='1')return'AGENT'; else if(value=='2')return 'COMPANY'; 
			else if(value=='3')return 'DEPARTMENT'; else if(value==4) return 'OFFICE';
			else return value;
	});
};

Ext.extend(OfficeManager, Gfa.view.BaseSingleView, {
	initData : function(){
		this.entityConfig = system.Office;
		this.dwrService = OfficeService;
		this.dwrMethod = 'saveOrUpdateOffices';
		this.popupWidth = 550;
		this.popupHeight = 380;
	},
	
	buildEditComposite : function(){
		return Gfa.FormHelper.buildEditForm(this.entityConfig, this);
	},
	
	saveAction:function () {
		if(!this.frmPopup.form.isValid())return ;
		if(this.eidtMode=='new') {
			var record=this.store.insertNewRecord();
			this.frmPopup.form.updateRecord(record);
		}else if(this.eidtMode=='edit'){
			this.editedRecord.set('rowStatus',Gfa.GlobalConstant.ROWSTATUS_MODIFIED);
			this.frmPopup.form.updateRecord(this.editedRecord);
//			this.editedRecord.set('active',this.editedRecord.get('active')&&this.editedRecord.get('active')==true?1:0);
		}else {
			this.frmPopup.form.updateRecord(this.editedRecord);
		}
		this.popupWindow.hide();
	},

	onPopupShow : function() {
		var superiorOfficeCode = this.frmPopup.form.findField('superiorOfficeCode');
		CommonService.findByProperty('com.wef.system.entity.Office', 'officeCode', superiorOfficeCode.getValue(), {
			callback : function(result){
				if(result.length > 0){
					superiorOfficeCode.setValue(result[0]);
				}
			}, async : false
		});
	},

	unhideAction : function() {
		this.topPanel.form.reset();
		this.store.load();
	}
	
});

Ext.onReady(function(){
	new OfficeManager();
});